package pos.data;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import pos.domain.ProductCat;

public class JDBCProductCatDAO implements IProductCatDAO {
	private Connection conn;
	
	public JDBCProductCatDAO () {
		conn = ConnectionManager.getInstance().checkOut();
	}

	@Override
	public void deleteCategory(String categoryid) {
		String sql = "DELETE FROM ProductCat WHERE (productCatID = ?)";
		PreparedStatement stmt = null;
		
		try{
			stmt = conn.prepareStatement(sql);
			
			stmt.setString(1, categoryid);
			stmt.executeUpdate();
			
		} catch (SQLException e) {
			System.out.println("Message: " + e.getMessage());
			System.out.println("SQLState: " + e.getSQLState());
			System.out.println("ErrorCode: " + e.getErrorCode());
		} finally {
			try {
				if (stmt != null)
					stmt.close();
			} catch (SQLException e) {
			}
		}
	}

	@Override
	public ProductCat selectCategory(String Categoryid) {
		// TODO Auto-generated method stub
		return null;
	}

}
